package com.d5xx.hunters.events;

import com.d5xx.hunters.API.Hunter;
import com.d5xx.hunters.API.HunterPlayer;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockBreakEvent;

public class PlayerBlock implements Listener {
    @EventHandler
    public void onBlockBreak(BlockBreakEvent event) {
        Player player = event.getPlayer();
        HunterPlayer hunterPlayer = Hunter.getHunterPlayer(player);
        switch (hunterPlayer.getType()) {
            case "lobby":
            case "lobby-waiting":
            case "death":
            case "game-fall":
                if (!player.getLocation().subtract(0, 1, 0).getBlock().getType().equals(Material.GLASS)) break;
                event.setCancelled(true);
        }
    }
}
